Return full path here as expected, not just the basename.
authorCarlos Garnacho <carlos@imendio.com>
Sun, 15 Jun 2008 23:32:11 +0000 (23:32 +0000)
committerCarlos Garnacho <carlosg@src.gnome.org>
Sun, 15 Jun 2008 23:32:11 +0000 (23:32 +0000)
2008-06-15  Carlos Garnacho  <carlos@imendio.com>

        * gtk/gtkfilechooser.c (gtk_file_chooser_get_filename): Return full
        path here as expected, not just the basename.

        * gtk/gtkfilechooserdefault.c
        (gtk_file_chooser_default_update_current_folder): Ensure that we keep
        a reference to file, since it can be destroyed when switching back to
        browse mode.

        * gtk/gtkfilesystem.c (get_icon_for_special_directory): Removed, home
        and desktop directories are dealt by the filechooser as normal files,
        not volumes, so the icon for these is handled directly by GIO.
        (_gtk_file_system_volume_render_icon): Update caller.

svn path=/trunk/; revision=20393

ChangeLog
gtk/gtkfilechooser.c
gtk/gtkfilechooserdefault.c
gtk/gtkfilesystem.c

index f491ce250f9d12c5142067ec1f56ce86f9b5db8f..ce37ce0e6fe9d7696a21c46fa20441cc880e28f9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2008-06-15  Carlos Garnacho  <carlos@imendio.com>
+
+       * gtk/gtkfilechooser.c (gtk_file_chooser_get_filename): Return full 
+       path here as expected, not just the basename.
+
+       * gtk/gtkfilechooserdefault.c
+       (gtk_file_chooser_default_update_current_folder): Ensure that we keep
+       a reference to file, since it can be destroyed when switching back to
+       browse mode.
+
+       * gtk/gtkfilesystem.c (get_icon_for_special_directory): Removed, home
+       and desktop directories are dealt by the filechooser as normal files,
+       not volumes, so the icon for these is handled directly by GIO.
+       (_gtk_file_system_volume_render_icon): Update caller.
+
 2008-06-15  Matthias Clasen  <mclasen@redhat.com>
 
        * gtk/gtkcellrendererpixbuf.c: Add a gicon property.
index 2f089c581be588bc2cd131f72b3c2c5a556d0f9f..fa003eb27f5eb12a433cc0dce7cdec52f5712d34 100644 (file)
@@ -454,7 +454,7 @@ gtk_file_chooser_get_filename (GtkFileChooser *chooser)
 
   if (file)
     {
-      result = g_file_get_basename (file);
+      result = g_file_get_path (file);
       g_object_unref (file);
     }
 
index b00473fd60159f7f08cb05013d9425e9b9c3961d..07b9eebf9af00e74395b1690f5677f88e2fc5882 100644 (file)
@@ -6982,6 +6982,8 @@ gtk_file_chooser_default_update_current_folder (GtkFileChooser    *chooser,
 
   profile_start ("start", NULL);
 
+  g_object_ref (file);
+
   switch (impl->operation_mode)
     {
     case OPERATION_MODE_SEARCH:
@@ -7001,6 +7003,7 @@ gtk_file_chooser_default_update_current_folder (GtkFileChooser    *chooser,
                   GTK_FILE_CHOOSER_ERROR_BAD_FILENAME,
                   _("Cannot change to folder because it is not local"));
 
+      g_object_unref (file);
       profile_end ("end - not local", NULL);
       return FALSE;
     }
@@ -7024,6 +7027,7 @@ gtk_file_chooser_default_update_current_folder (GtkFileChooser    *chooser,
                               data);
 
   set_busy_cursor (impl, TRUE);
+  g_object_unref (file);
 
   profile_end ("end", NULL);
   return TRUE;
index c707957540fa660b34948f48a663482d188de7ea..8112ffb93fe6c7743343c415bdeafabc37a1fb2c 100644 (file)
@@ -1662,50 +1662,6 @@ get_pixbuf_from_gicon (GIcon      *icon,
   return pixbuf;
 }
 
-static GIcon *
-get_icon_for_special_directory (GFile *file)
-{
-  const gchar *special_dir;
-  GFile *special_file;
-
-  special_dir = g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP);
-  special_file = g_file_new_for_path (special_dir);
-
-  if (g_file_equal (file, special_file))
-    {
-      const char *names[] = { 
-        "user-desktop", 
-        "gnome-fs-desktop", 
-        "folder", 
-        "gtk-directory",
-        NULL 
-      };
-      g_object_unref (special_file);
-      return g_themed_icon_new_from_names ((char **)names, -1);
-    }
-
-  g_object_unref (special_file);
-  special_dir = g_get_home_dir ();
-  special_file = g_file_new_for_path (special_dir);
-
-  if (g_file_equal (file, special_file))
-    {
-      const char *names[] = { 
-        "user-home", 
-        "gnome-fs-home", 
-        "folder", 
-        "gtk-directory",
-        NULL 
-      };
-      g_object_unref (special_file);
-      return g_themed_icon_new_from_names ((char **)names, -1);
-    }
-
-  g_object_unref (special_file);
-
-  return NULL;
-}
-
 GdkPixbuf *
 _gtk_file_system_volume_render_icon (GtkFileSystemVolume  *volume,
                                     GtkWidget            *widget,
@@ -1724,23 +1680,13 @@ _gtk_file_system_volume_render_icon (GtkFileSystemVolume  *volume,
   DEBUG ("volume_get_icon_name");
 
   if (IS_ROOT_VOLUME (volume))
-    icon = g_themed_icon_new_from_names ((char **)harddisk_icons, -1);
+    icon = g_themed_icon_new_from_names ((char **) harddisk_icons, -1);
   else if (G_IS_DRIVE (volume))
     icon = g_drive_get_icon (G_DRIVE (volume));
   else if (G_IS_VOLUME (volume))
     icon = g_volume_get_icon (G_VOLUME (volume));
   else if (G_IS_MOUNT (volume))
-    {
-      GMount *mount = G_MOUNT (volume);
-      GFile *file;
-
-      file = g_mount_get_root (mount);
-      icon = get_icon_for_special_directory (file);
-      g_object_unref (file);
-
-      if (!icon)
-       icon = g_mount_get_icon (mount);
-    }
+    icon = g_mount_get_icon (G_MOUNT (volume));
 
   if (!icon)
     return NULL;